package main

func checkInclusion(s1 string, s2 string) bool {
	//得到子串的长度
	var length = len(s1)
	var length2 = len(s2)
	if length > length2 {
		return false
	}
	var char1, char2 [26]int
	//统计子串中每个字符的个数
	for i := 0; i < length; i++ {
		char1[s1[i]-'a']++
		char2[s2[i]-'a']++
	}
	if char2 == char1 {
		return true
	}
	for j := length; j < len(s2); j++ {
		char2[s2[j]-'a']++
		char2[s2[j-length]-'a']--
		if char1 == char2 {
			return true
		}
	}
	return false
}

// 字符串的排列
// 1，看子串中每个字母在目标字符串中存在
// 2，得到子串的所有排序情况
func main() {
	s1 := "ab"
	s2 := "eidbaooo"
	checkInclusion(s1, s2)

	//var strs = []string{"tars", "rats", "arts", "star"}
	//groups := numSimilarGroups(strs)
	//fmt.Println(groups)

}
